<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        function object(o) {
            function F() {}
            F.prototype = o;
            return new F();
        }

        function inheritPrototype(Person, Mother) {
            var prototype = object(Mother.prototype);
            prototype.constructor = Person;
            Person.prototype = prototype;
        }

        function Mother(age) {
            this.age = age;
            this.hobby = ['running', 'football']
        }
        Mother.prototype.showAge = function() {
            console.log(this.age);
        };

        function Person(name, age) {
            Mother.call(this, age);
            this.name = name;
        }

        inheritPrototype(Person, Mother);

        Person.prototype.showName = function() {
            console.log(this.name);
        }

        var p1 = new Person('Jack', 20);
        p1.hobby.push('basketball'); //p1:'Jack'; __proto__:20,['running','football']
        var p2 = new Person('Mark', 18); //p2:'Mark'; __proto__:18,['running','football']
        console.log(p1);
        console.log(p2);
    </script>
</body>

</html>